<?php
/**
 * Created by PhpStorm.
 * User: myhonour
 * Date: 2017/10/5
 * Time: 20:22
 */

namespace app\admin\model;


use Category\Category;

class AdminNav extends \think\Model
{

    /** 获取当前 用户的 菜单
     * @return array
     */
    public static function getMyNav(){
       $allNav  =    self::where(['status'=>1])->order('sort','desc')->select();
       $navList =   [];
       if (empty($allNav)) return $navList;
       $auth = new  AuthHandle();
       foreach ($allNav as $k   =>  $v){
            if ($v['name'] == '#' OR $v['name'] == '' OR $auth->AuthCheck($v['name'])){
                $navList[$k] =   $v;
            }
       }
       return Category::toLayer($navList,'child',0,'admin_nav_id');
    }
}